﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FluentScheduler;
using XYAuto.MonitorData.Chitunion.Bll.Provider;
using XYAuto.MonitorData.Chitunion.Infrastruct.Logger;

namespace XYAuto.MonitorData.Chitunion.RunTask.Scheduler.Registry
{
    public class MonitorDataTaskScheduler : IJob
    {
        public void Execute()
        {
            Loger.Log4Net.Info($" MonitorDataTaskScheduler start ...");
            if (!CurrentRegistryScheduler.MonitorConfig.IsStart)
            {
                Loger.Log4Net.Info($" MonitorDataTaskScheduler IsStart 是处于关闭状态，不进行操作 ...");
                return;
            }
            try
            {
                new MonitorProvider().DoMonitor();
            }
            catch (Exception exception)
            {
                Loger.Log4Net.Error($" MonitorDataTaskScheduler is error .:{exception.Message}," +
                     $"{System.Environment.NewLine}{exception.StackTrace ?? string.Empty}");
            }

            Loger.Log4Net.Info($" MonitorDataTaskScheduler completed ...");
        }
    }
}
